<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <link rel="stylesheet" href="./css/bootstrap-3.3.7.css">
    <script src="./js/vue-2.4.0.js"> </script>
    <script src="./js/vue-resource-1.3.4.js"> </script>
    <script src="./js/vue-router-3.0.1.js"> </script>
    <style>
        .div{
            border:1px solid red;
        }
        .div2{
            border:1px solid blue;
        }
    </style>
</head>
<body>

    
    <div id="tem1">
        <!-- <a href="#/login">login</a>
        <a href="#/register">register</a> -->
        <hr>
        <router-link to="/login">login</router-link>
        <router-link :to="kk">register</router-link>
        <router-view></router-view>
    </div>

    <template id="trlogin">
        <div class="div">这是登录</div>
    </template>
    <template id="trregister">
        <div  class="div2">这是注册{{$route.query.id}}</div>
    </template>

    <div id="app">
            <p>
              <router-link to="/user/foo">/user/foo</router-link>
              <router-link to="/user/bar">/user/bar</router-link>
            </p>
            <router-view></router-view>
          </div>
    
</body>
<script src="./js/路由.js"></script>
    <script src="./js/jquery.js"></script>
    <script src="./js/bootstrap.js"></script>
    <script>    
            const User = {
                template: `<div>User {{ $route.params.id }}</div>`,
                watch: {
                    '$route' (to, from) {
                    // 对路由变化作出响应...
                    console.log(from);
                    console.log(to);
                }
            }
            }
                const router = new VueRouter({
                routes: [
                    { path: '/user/:id', component: User }
                ]
                })

                const app = new Vue({ router }).$mount('#app')
    </script>
    </html>